package com.csaba.connector.otp;

import com.csaba.connector.ServiceException;
import com.csaba.connector.model.Session;
import com.csaba.connector.otp.model.OTPRequestFactory;
import com.csaba.connector.otp.model.OTPSession;
import com.csaba.connector.service.LogoutService;

public class OTPLogoutService implements LogoutService
{
	//private final static Logger logger = LoggerHelper.getDefaultLogger();

	@Override
	public void execute( final Session session ) throws ServiceException
	{
		if ( !( session instanceof OTPSession ) )
			throw new ServiceException("Unsupported session for OTP services: " + session.getClass().getName());

		final OTPSession otp = (OTPSession) session;

		final String result = otp.doGet(OTPRequestFactory.HOMEBANK_REQUEST_URL_BASE + OTPRequestFactory.REQUEST_LOGOUT);
		otp.debugFile("logout", result);

		//do not process result. it is a browser window closing javascript.

	}

}
